home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / share / ufw / ufw-init < prev    next >
Encoding:
Text File  |  2009-04-03  |  1.5 KB  |  60 lines

  1. #!/bin/sh -e
  2.  
  3. # ufw-init: helper script to be used by ufw itself
  4. #
  5. # Copyright (C) 2008-2009 Canonical Ltd.
  6. #
  7. #    This program is free software: you can redistribute it and/or modify
  8. #    it under the terms of the GNU General Public License version 3,
  9. #    as published by the Free Software Foundation.
  10. #
  11. #    This program is distributed in the hope that it will be useful,
  12. #    but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. #    GNU General Public License for more details.
  15. #
  16. #    You should have received a copy of the GNU General Public License
  17. #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
  18. #
  19.  
  20. if [ -s "/usr/share/ufw/ufw-init-functions" ]; then
  21.     . "/usr/share/ufw/ufw-init-functions"
  22. else
  23.     echo "Could not find $s (aborting)"
  24.     exit 1
  25. fi
  26.  
  27. case "$1" in
  28. start)
  29.     # process multiple error strings
  30.     ret=0
  31.     output=`ufw_start` || ret="$?"
  32.     echo "$output" | while read line ; do
  33.         echo "$line"
  34.     done
  35.     exit "$ret"
  36.     ;;
  37. stop)
  38.     ufw_stop || exit "$?"
  39.     ;;
  40. force-stop)
  41.     ufw_stop --force || exit "$?"
  42.     ;;
  43. restart|force-reload)
  44.     ufw_reload || exit "$?"
  45.     ;;
  46. status)
  47.     ufw_status || exit "$?"
  48.     ;;
  49. flush-all)
  50.     # Use sparingly. It flushes the built-in chains, deletes all non-builtin
  51.     # chains and resets the policy to ACCEPT
  52.     flush_builtins || exit "$?"
  53.     ;;
  54. *)
  55.     echo "Usage: /etc/init.d/ufw {start|stop|restart|force-reload|force-stop|flush-all|status}"
  56.     exit 1
  57.     ;;
  58. esac
  59.  
  60.